<template>
  <div class="One">
    <h1>{{arrName}}</h1>
    <button @click="getName">随机出名字</button>
  </div>
</template>

<script>
// @ is an alias to /src


export default {
  name: 'One',
  data () {
    return {
    arrName:'',
    arr:["小花", "小明", "小可爱", "小王"]
    }
  },
  methods: {
    getName(){
      let num=this.arr.length
      let i=Math.floor(Math.random()*num)
      this.arrName=this.arr[i]
    }
  }
}
</script>
